home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8416 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: access1.digex.net!not-for-mail
  2. From: ell@access1.digex.net (Ell)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Bizzare C++ bug...PLEASE CHECK IT OUT
  5. Date: 17 Feb 1996 23:42:10 GMT
  6. Organization: The Universe
  7. Message-ID: <4g5p4i$lhk@news4.digex.net>
  8. References: <4fsns9$8ga3@flute.aix.calpoly.edu> <4g56r1$ep5@druid.borland.com>
  9. NNTP-Posting-Host: access1.digex.net
  10. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  11.  
  12. Pete Becker (pete@borland.com) wrote:
  13. : In article <4fsns9$8ga3@flute.aix.calpoly.edu>, mporcell@flute.aix.calpoly.edu 
  14. : says...
  15. : >
  16. : >Clearly the call to the overloaded operator<< (r2) at r4 will cause a crash
  17. : >because it is a call from a base class constructor (B) to a virtual print 
  18. : >function (r1) that does not get defined until the derived class C (r5).
  19. : Nope. Calling a virtual function in a constructor results in a call to the 
  20. : version of the function defined for that class. It does not call a "function 
  21. : that does not get defined until the derived class". It is perfectly legal, 
  22. : perfectly safe, and almost certainly incorrect.
  23.  
  24. Yes, the real problem would be calling a pure virtual of a class in its
  25. ctor.  This has undefined results, from what I know.
  26.  
  27. Elliott
  28.